package com.zyzd.custom.module;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.zyzd.custom.R;
import com.zyzd.custom.widget.attributedesc.BaseAttributeDescView;
import com.zyzd.custom.widget.attributedesc.TextEntity;

import java.util.ArrayList;
import java.util.Random;

public class AttributeDescViewActivity extends AppCompatActivity {

    private BaseAttributeDescView mAttributeDescView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_auto_linefeed_view);
        mAttributeDescView = findViewById(R.id.attributeDescView);
        mAttributeDescView.setData(getTextList());
    }

    public ArrayList<TextEntity> getTextList() {
        ArrayList<TextEntity> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(new TextEntity(getRandomText()));
        }
        return list;
    }

    public String getRandomText() {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < new Random().nextInt(30); i++) {
            sb.append(i);
        }

        return sb.toString();
    }
}
